﻿@{
    ViewBag.Title = "WarehouseInfoForm";
    Layout = "~/Views/Shared/_Form.cshtml";
}@using LeSoft.Application.Code;
<script>
    var keyValue = request('keyValue'), organizeid = "";
    var _organizeid = "@OperatorProvider.Provider.Current().CompanyId", _pstructId = "", _allcode = "", WIDTH = "";
    $(function () {
        initControl();
    })

    //初始化控件
    function initControl() {

        $("#ParentId").ComboBoxTree({
            url: "../../ResourceManage/RS_Warehouse/GetTreeJson",
            description: "==请选仓库==",
            height: "150px"
        });
        $("#PStructId").ComboBoxTree({
            url: "../../ResourceManage/RS_PStructs/GetTreeJson",
            description: "==请选所属区域==",
            height: "120px"
        });
        $("#OrganizeId").ComboBoxTree({
            url: "../../BaseManage/Organize/GetTreeJsonById",
            height: "150px",
            description: "===选择组织机构===",
            click: function (item) { 
            },
           
        });
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../ResourceManage/RS_Warehouse/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);

                }
            });
        }

    }
    //保存表单
    function AcceptClick() {
        debugger;
        if (!$("#form1").Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls(keyValue);
        if (postData["ParentId"] == "") {
            postData["ParentId"] = 0;
        }
        $.SaveForm({
            url: "../../ResourceManage/RS_Warehouse/SaveForm?keyValue=" + keyValue,
            param: postData,
            loading: "正在保存数据...",
            success: function () {
               // top.frames["MSettingRuleForm"].$("#gridTable").trigger("reloadGrid");
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
                dialogClose()  
               
            }
        })
    }



</script>
<div class="ui-layout" id="layout" style="height: 80%; width: 90%;">
    <table class="form" style="margin:0px auto; ">
        <tr style="height:10px;"></tr>
        <tr>
            <td class="formTitle">所属机构<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><div id="OrganizeId" type="selectTree" isvalid="yes" checkexpession="NotNull" class="ui-select"></div>
        </tr>
        <tr>
            <td class="formTitle">仓库名称<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><input id="Name" class="form-control" isvalid="yes" checkexpession="NotNull" type="text" /></td>
        </tr>
        <tr>
            <td class="formTitle">仓库编号<font face="宋体">*</font></td>
            <td class="formValue" colspan="3"><input id="Code" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /></td>
        </tr>
        <tr>
                <td class="formTitle">上级仓库</td>
                <td class="formValue" colspan="3"><div id="ParentId" type="selectTree"  class="ui-select"></div>
            </tr>
        
        <tr>
            <td class="formTitle">所属区域</td>
            <td class="formValue" colspan="3">
                <div id="PStructId" type="selectTree" class="ui-select"></div>
            </td>
        </tr>
        <tr>

            <td class="formTitle">位置描述</td>
            <td class="formValue" colspan="3"><input id="PSMemo" type="text" class="form-control" /></td>

        </tr>
        <tr>
            <td class="formTitle">默认仓库</td>
            <td class="formValue" colspan="3">
                <div class="checkbox">
                    <label>
                        <input id="IsDefault" type="checkbox" />
                        默认
                    </label>
                </div>
            </td>

        </tr>

        <tr>
            <td class="formTitle">备注</td>
            <td class="formValue" colspan="3"><textarea id="Description" class="form-control" style="height: 70px;"></textarea></td>
        </tr>
    </table>
</div>


